package cn.ekuma.pos.pda.finder;

import java.util.ArrayList;
import java.util.List;
import android.app.ProgressDialog;
import android.view.View;

import cn.ekuma.data.ui.android.AbstractViewBeanListAdapter;
import cn.ekuma.data.ui.android.AbstractListChildFinderActivate;
import cn.ekuma.epos.datalogic.DataLogicPDA;
import cn.ekuma.epos.datalogic.I_DataLogicERP;
import cn.ekuma.pos.pda.finder.adapter.ProductCustomerAdapter;
import com.openbravo.bean.Product;
import com.openbravo.bean.crm.viewbean.ProductCustomerView;
import com.openbravo.data.basic.BasicException;

public class ProductCustomerViewFinderActivator extends AbstractListChildFinderActivate<ProductCustomerView,Product>{

	public ProductCustomerViewFinderActivator() {
		super(DataLogicPDA.getDataLogic());
		// TODO Auto-generated constructor stub
	}

	@Override
	public AbstractViewBeanListAdapter getListAdapter() {
		return new ProductCustomerAdapter(this);
	}

	@Override
	public void filterParaReset() {
	}

	@Override
	public void initAdvSeachView() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public boolean isQuickSeachAble() {
		return false;
	}


	@Override
	protected void onResume() {
		super.onResume();
		onQuickSeach(null);
	}

	@Override
	public void onQuickSeach(String inputText) {
		final ProgressDialog dialog = ProgressDialog.show(this, "", 
		        "查旬中，请稍等 …", true, true);
		new Thread(){
			@Override
			public void run(){
				I_DataLogicERP dlERP=DataLogicPDA.getDLERP();
				try {
					List<ProductCustomerView> lists=dlERP.listProductCustomerViewByProductId(parent.getID());
					if(lists==null)
						lists=new ArrayList<ProductCustomerView>();
					mHandler.obtainMessage(MSG_SUCCESS,lists).sendToTarget();//获取图片失败   

				} catch (BasicException e) {
					mHandler.obtainMessage(MSG_FAILURE).sendToTarget();//获取图片失败   
				}
				dialog.dismiss(); 
			}
			}.start();
		
	}

	@Override
	public View createFilterPanel() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public View createAdvFilterPanel() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Class getFindClass() {
		// TODO Auto-generated method stub
		return ProductCustomerView.class;
	}

	@Override
	public Class getParentClass() {
		// TODO Auto-generated method stub
		return Product.class;
	}
	
	
}
	
